<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<h1>Spending BTC</h1>
Spending your Bitcoins is a secured process that requires several steps.<br>
It involves moving files between your <u>online PC</u> and your offline <u>wallet machine</u>.<br>
USB flash disk is probably the most convenient medium to use for this purpose.
<br>
<br>
Never move any files others than the ones that you actually need to move, which are:<br>
<ul><li><code>balance/</code> folder created by <b>balio</b>
or <code>balance.zip</code> / <code>payment.zip</code> file
generated by <b>WebUI</b> - you move it from <u>online PC</u> to <u>wallet machine</u>.</li>
<li>Text files with signed transactions - these you move from <u>wallet machine</u> to <u>online PC</u>.</li></ul>
<br>
Assuming that you would not sign a wrong transaction, nothing in the files you move between the two points is security sensitive, so you do not need to worry about protecting the medium (USB disk).
<br>


<h2><b>1. Export your balance</b></h2>
In order to spend your coins you will need to provide a current balance data to the computer that runs your <u>wallet</u>.

<br><br>

<table border="1" cellpadding="5" cellspacing="0">
<tr>
<td align="center"><b class="bigger">If you have no client: use balio tool</b>

<td align="center"><b class="bigger">If you have a running client: use WebUI</b>

<tr>
<td valign="top">
There is a tool <b>balio</b> that can fetch a balance of your wallet from a public block explorers.<br>
<br>
Run the tool from a command line with the file name of your wallet as the command line parameter (e.g. <code>balio wallet.txt</code>).<br>
Eventually enter the list of space separated BTC addresses that you want to fetch the balance for
(<code>balio 1Hz96kJKF2HLPGY15JWLB5m9qGNxvt8tHJ 3NEDeMiXubepj68RGCTXJyJc83cYXMpusw</code>).
<br>
<br>
This should create the <code>balance/</code> folder in the current directory, ready to be moved your <u>wallet machine</u>.<br>
<br>
<i><b>Note:</b> fetching the balance this way exposes your privacy.</i><br>
<i>To </i><i>use <b>balio</b> through <b>Tor</b>, set TOR environment variable in your system, pointing it to your tor's socks proxy (e.g. <code>TOR=localhost:9050</code>).</i><br>
<i>Additionally, despite of using Tor, to further protect your privacy try to fetch balance of single addresses instead of entire wallets.</i>


<td valign="top">
From the moment a content of <code>wallet.txt</code> file is properly stored in your browser, you can check and export your balance.
Do it on the <b>Wallet</b> tab.<br>
<br>
To spend your coins, you can choose one of the two ways here.
It is recommended to use <b>MakeTx</b> page that allows you to assemble a transaction using a convenient,
interactive way.<br>
<br>



<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td align="center" width="50%"><b>MakeTx tab: Use Coin Control</b>

<td align="center" width="50%"><b>Wallet tab: download balance.zip</b>

<tr>
<td valign="top">
<br>
After you fill in all the transaction details, it will give you <code>payment.zip</code> with the exact command that you shall execute at the wallet machine.<br>
<br>

<td valign="top">
Use <b>Wallet</b> page of WebUI to download <code>balance.zip</code> file.<br>
<br>
Extract the zip file to get the <code>balance</code> folder.<br>
<br>


</table>
</table>



<h2><b>2. Sign your transaction</b></h2>


As mentioned before, to spend your money you need to move the most recent <code>balance/</code> folder, from <u>online PC</u> to <u>wallet machine</u>.<br>
For security reasons, you should execute <code>wallet</code> command only on offline machine - one that never was nor will be connected to Internet.<br>

<h3>Manual mode</h3>
To spend your coins, order the wallet to make and sign a new transaction, using a command like:<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;wallet -send 1JbdKe4eBwtexisGTbCKY5v5CfphtdZXJs=0.01</code><br>
Please note no spaces between the address, the equal sign and the value.<br>
The value represents the amount in BTC, which you request to send to the given address.<br>
<br>

There are also other switches which you may find useful at this stage.<br>
One of them (<code>-fee</code>) allows you to control the transaction's' fee.<br>
To see all the wallet's options, just run <code>wallet -h</code>

<h3>Smart mode</h3>
If you used <b>MakeTx</b> tab to make the transaction, all you have to do now is to extract <b>payment.zip</b>
file at the <u>wallet</u> computer and execute there the exact command from the <b>pay_cmd</b> file.
For further convenience, you can rename it to <i>pay_cmd.sh</i> or <i>pay_cmd.bat</i> by editing the <a href="gocoin_manual_config.html">config file</a>.


<h2><b>3. Verify signed transaction</b></h2>

If everything goes well with the wallet's' <code>-send ...</code> command,
it will create a text file with a signed transaction.
The file is named like <code>01234567.txt</code> - this is the file you need to move
to your online node in order to notify the network about your payment.
Before you broadcast your signed transaction to the network,
verify carefully that it does exactly what you intended.
<br>
<br>

<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td align="center" width="30%"><b>Wallet</b>
<td align="center" width="40%"><b>WebUI</b> (requires client)


<tr>
<td valign="top">
To see a decoded content of a transaction, execute:<br>
<code>  wallet -d rawtxdata.txt</code>


<td valign="top">
Use <b>PushTx</b> button or <i>Upload Transaction File</i> form.<br>
After you upload the transaction, you should see it decoded.<br>
Then have a look if it makes sense. And if it does, send it away...<br>
</table>

<br>
<i><b>Note: always verify transaction before broadcasting it!</b><br>
Verify that the decoded content of a transaction matches exactly what you intended to spend.</i>
<i>If what you see would not be what you wanted, do not broadcast the transaction, but destroy the transaction file instead.<br>
</i>
<i>If you follow this simple rule, your money will be safe, even in case if there was a critical bug in the wallet application that would otherwise destroy your coins (which we hope there isn't).</i>
<br>
<br>
<h2><b>4. Broadcast the transaction</b></h2>
After making sure that the transaction does indeed what you intended, you must broadcast it to the network, in order to actually move your coins.<br>
<br>


<table border="1" cellpadding="5" cellspacing="0">
<tr>
<td align="center" width="35%"><b>WebUI</b> (requires client)
<td align="center" width="35%"><b>TextUI</b> (requires client)
<td align="center" width="30%"><b>Web services</b>


<tr>
<td valign="top">
Load the transaction using the client's WebUI.
Click on the envelope icon with a green arrow to broadcast a loaded transaction to the network.
Coming back to <i>Transactions</i> tab later, press the button in the "Own TXs" row,
to see all the transactions you've loaded (those with a red background are yours).
You can also unload a previously loaded transaction by clicking on the red X icon.


<td valign="top">
Use <code>stx</code> command with the transaction ID as its parameter (you had the ID printed, when loading it).

<td valign="top" rowspan="3">
Use any web page that allows you to push a raw transaction to the bitcoin network.<br>
<br>
For instance:<br>
&bull;&nbsp;<a href="https://blockchain.info/pushtx">https://blockchain.info/pushtx</a><br>
&bull;&nbsp;<a href="https://coinb.in/send-raw-transaction.html">https://coinb.in/send-raw-transaction.html</a><br>
&bull;&nbsp;More at <a href="https://en.bitcoin.it/wiki/Transaction_broadcasting">https://en.bitcoin.it/wiki/Transaction_broadcasting</a><br>
<br>

Just copy the text from the transaction file, paste it into the form and push the button.<br>
<br>

<i><b>Note:</b> being concerned about exposing your IP, you may want to access the web page via Tor.</i><br>
<i><br>
</i>

<tr><td valign="top" colspan="2" align="center">
<b>Re-broadcasting transactions</b>

<tr><td valign="top" colspan="2">
The client never broadcasts transactions unrequested, so if your transaction does not appear in the chain soon enough, you may want to re-broadcast it, using the same method as for the initial broadcasting. There may of course be other reasons why your transaction does not get confirmed (usually because the fee was too low), in which case re-broadcasting it will not help you much.<br>
<br>

There is also a TextUI command <code>stxa</code> that re-broadcasts all the transaction that have been loaded, but not yet confirmed by the network. Note that when a transaction gets mined into a block it gets removed from the list automatically.



</table>


</body>
</html>